import os

import shutil

gen = os.walk("date_analys")

while True:

    try:

        info = next(gen)


    except StopIteration:

        print('__pytcache__文件删除')

        break

    else:

        if '__pycache__'in info[1]:

            path = os.path.join(info[0],'__pycache__')

            shutil.rmtree(path)
